<?php

namespace Application\Form;
use Zend\Form\Form;
use Zend\Captcha;
use Zend\Form\Element;

class CommandeForm extends Form{
	
	public function __construct(){
		
		parent::__construct("Commande");
		
		$this->setAttribute('method','post');
		
		$this->add(array(
				'name' => 'nom',
				'attributes' => array(
						'type'  => 'text',
				),
				'options' => array(
						'label' =>_('Nom'),
				),
		));
		
		$this->add(array(
				'name' => 'prenom',
				'attributes' => array(
						'type'  => 'text',
				),
				'options' => array(
						'label' => _('Prénom'),
				),
		));
		
		$this->add(array(
				'name' =>'entreprise',
				'attributes'=>array(
						'type'=>'text',),
				'options'=>array(
						'label'=>_('Entreprise')
				)
		));
		
		$this->add(array(
				'name' =>'email',
				'attributes' =>array(
						'type'=>'text',
				),
				'options' =>array(
						'label' =>_('Email'),
				)
		));
		
		$this->add(array(
				'name' => 'telephone',
				'attributes' => array(
						'type'  => 'text',
				),
				'options' => array(
						'label' => _('Téléphone'),
				),
		));
		
		$this->add(array(
				'type' => 'Zend\Form\Element\Select',
				'name' => 'type_commande',
				'options' => array(
						'label' => _('Type de commande'),
						'value_options' => array(
								'1' => 'Vôtre commande',
								'2' => 'Site web',
								'3' => 'Logiciel de gestion',
								'4' => 'Formation',
						),
				),
				'attributes' => array(
						'value' => '1' //set selected to '1'
				)
		));
		
		$this->add(array(
				'name' => 'message',
				'attributes'=>array(
						'type'=>'textarea'
				),
				'options' => array(
						'label' => _('Message'),
				),
		));
		
		/*$captcha = new Element\Captcha('captcha');
		$captcha->setCaptcha(new Captcha\Dumb());
		$captcha->setLabel('Recopier ce texte');
		
	//	$csrf = new Element\Csrf('security');
		$this->add($captcha);
		*/
		$this->add(array(
				'name' => 'submit',
				'attributes' => array(
						'type'  => 'submit',
						'width' => '30px',
						'value' => 'Envoyer',
						'id' => 'submitbutton',
				),
		));
	}
}

?>